<div class="order">
	<table>
		<caption>THÔNG TIN ĐƠN HÀNG</caption>
		<thead>
		<tr>
			<th>Mã hóa đơn</th>
			<th>Tên Khách Hàng</th>
			<th>Ngày đặt</th>
			<th>Nơi nhận</th>
			<th>Ghi chú</th>
			<th>Trạng thái xử lý</th>
		</tr>
		</thead>
		<tbody>
		<tr>
			<td><?php echo $this->orderInfo['order_code']?></td>
			<td>
				<?php echo $this->userInfo['user_email']?>
			</td>
			<td>
			<?php
				$date = date_create($this->orderInfo['order_creation_time']);
				echo date_format($date, 'd/m/Y');
			?>
			</td>
			<td><?php echo $this->orderInfo['order_address']?></td>
			<td><?php echo $this->orderInfo['order_note']?></td>
			<td>
				<?php 
					if($this->orderInfo['order_status']==Application_Model_DbTable_Order::ORDER_NEW){
						echo 'Mới đặt hàng';
					}elseif ($this->orderInfo['order_status']==Application_Model_DbTable_Order::ORDER_PROCESSING){
						echo 'Đang xử lý';
					}else{
						echo 'Đã xử lý';
					}

				?>
			</td>
		</tr>
		</tbody>
	</table>
	
		<table class="order-detail-table">
		<caption>CHI TIẾT ĐƠN HÀNG</caption>
		<thead>
			<tr>
				<th>Tên sản phẩm</th>
				<th>Số lượng</th>
				<th>Đơn giá</th>
				<th>Thành tiền</th>			
			</tr>
		</thead>
		<tbody>
		<?php 
			$total = 0;
			foreach($this->orderdetail as $item):	
				$mdProduct = new Application_Model_DbTable_Product();
				$product = $mdProduct->find($item['order_detail_product_id'])->current();
					$price = $item['order_detail_product_quantity'] * $product['product_price'];
					$total += $price;
		?>
		<tr>
			<td>
				<?php echo $product['product_name']?>
			</td>
			<td>
				<?php echo $item['order_detail_product_quantity']?>
			</td>
			<td>
				<?php echo $product['product_price']?>
			</td>
			<td>
				<?php echo number_format($price);?>
			</td>			
		</tr>
		<?php endforeach;?>
		<tr>
			<td colspan='4'>Tổng cộng: <?php echo number_format($total)?></td>
		</tr>
		</tbody>
	</table>
	
	
	
	
	
	
	
	<table >
		<caption>THÔNG TIN KHÁCH HÀNG</caption>
		<thead>
			<tr>
				<th>Tên khách hàng</th>
				<th>Email</th>
				<th>Điện thoại</th>
				<th>Địa chỉ</th>
				
			</tr>
		</thead>
		<tbody>
		<tr>
			<td><?php echo $this->userInfo['user_fullname']?></td>
			<td>
				<?php echo $this->userInfo['user_email']?>
			</td>
			<td>
				<?php echo $this->userInfo['user_phone']?>
			</td>
			<td><?php echo $this->userInfo['user_address']?></td>
			
		</tr>
		</tbody>
	</table>
	

</div>